import axios from 'axios'

// 创建一个 axios 实例
const service = axios.create({
  // 请求超时时间
  timeout: 30000
})

// 配置请求的根路径
// service.defaults.baseURL = 'http://10.68.2.9/HQProcessCMSApi/api' // 测试环境
service.defaults.baseURL = 'http://10.68.2.224/HQProcessCMSApi/api'
// service.defaults.baseURL = 'https://autumnfish.cn/'
service.defaults.headers.put['Content-Type'] = 'application/json;charset=UTF-8;multipart/form-data;application/x-www-form-urlencoded'
// service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8;multipart/form-data'

// 添加请求拦截器
service.interceptors.request.use(
  config => {
    return config
  },
  error => {
    console.log('请求拦截器:', error)
  }
)
// 添加响应拦截器
service.interceptors.response.use(
  response => {
    return response
  },
  error => {
    console.log('响应拦截器:', error)
  }
)

export default service
